package com.ruoyi.web.controller.house;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.costQuery.domain.HouseDoorCostQuery;
import com.ruoyi.costQuery.service.IHouseDoorCostQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 户资金修改查询Controller
 * 
 * @author ruoyi
 * @date 2023-04-25
 */
@RestController
@RequestMapping("/house/costQuery")
public class HouseDoorCostQueryController extends BaseController
{
    @Autowired
    private IHouseDoorCostQueryService houseDoorCostQueryService;

    /**
     * 查询户资金修改查询列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HouseDoorCostQuery houseDoorCostQuery)
    {
        startPage();
        List<HouseDoorCostQuery> list = houseDoorCostQueryService.selectHouseDoorCostQueryList(houseDoorCostQuery);
        return getDataTable(list);
    }

    /**
     * 导出户资金修改查询列表
     */
    @Log(title = "户资金修改查询", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HouseDoorCostQuery houseDoorCostQuery)
    {
        List<HouseDoorCostQuery> list = houseDoorCostQueryService.selectHouseDoorCostQueryList(houseDoorCostQuery);
        ExcelUtil<HouseDoorCostQuery> util = new ExcelUtil<HouseDoorCostQuery>(HouseDoorCostQuery.class);
        util.exportExcel(response, list, "户资金修改查询数据");
    }

    /**
     * 获取户资金修改查询详细信息
     */
    @GetMapping(value = "/{doorCostId}")
    public AjaxResult getInfo(@PathVariable("doorCostId") Long doorCostId)
    {
        return AjaxResult.success(houseDoorCostQueryService.selectHouseDoorCostQueryByDoorCostId(doorCostId));
    }


}
